/* 基础样式重置和变量定义 */
:root {
    --primary-color: #4361ee;
    --success-color: #06d6a0;
    --warning-color: #ffd166;
    --danger-color: #ef476f;
    --info-color: #118ab2;
    --dark-color: #073b4c;
    --light-color: #f8f9fa;
    --border-radius: 16px;
    --box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

/* 全局样式 */
body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    min-height: 100vh;
}

/* 页面标题区域 */
.page-header {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.page-header h2 {
    font-weight: 700;
    color: var(--dark-color);
    font-size: 2rem;
}

/* 主要成绩卡片 */
.score-main-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    transition: var(--transition);
    overflow: hidden;
    position: relative;
    min-height: 320px;
    backdrop-filter: blur(10px);
}

.score-main-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    z-index: 1;
}

.score-main-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* 成绩内容包装器 */
.score-content-wrapper {
    padding: 2rem 0;
    height: 100%;
}

/* 成绩显示部分 */
.score-display-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.score-label {
    font-size: 1.2rem;
    color: #6c757d;
    margin-bottom: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.score-display {
    font-size: 5rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.score-full {
    font-size: 1.8rem;
    color: #6c757d;
    margin-bottom: 0.8rem;
    font-weight: 500;
}

/* 进度条部分 */
.score-progress-section {
    margin-top: auto;
    padding-top: 2.5rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress-info .text-sm {
    font-size: 0.95rem;
    font-weight: 600;
}

/* 增强的进度条样式 */
.progress {
    height: 20px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

.progress-bar {
    border-radius: 12px;
    position: relative;
    transition: width 1.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    width: 0%; /* 初始为0，由JS控制动画 */
}

.progress-text {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.5px;
    opacity: 0; /* 初始隐藏，由JS控制显示 */
    transition: opacity 0.3s ease;
}

/* 图表容器 */
.chart-container {
    width: 100%;
    height: 260px;
    margin: 0 auto;
    position: relative;
}

/* 成绩状态卡片 */
.score-status-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    background: white;
    transition: var(--transition);
    height: 100%;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
}

.score-status-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.score-status-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.score-status-card .card-title {
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-color);
    font-size: 1.3rem;
}

.status-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
    justify-content: space-around;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 0.8rem 0;
    transition: var(--transition);
}

.status-item:hover {
    transform: translateX(5px);
}

.status-item i {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.status-item .label {
    display: block;
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.status-item .value {
    display: block;
    font-weight: 700;
    color: var(--dark-color);
    font-size: 1.1rem;
}

/* 评级颜色 */
.rating-90, .rating-91, .rating-92, .rating-93, .rating-94,
.rating-95, .rating-96, .rating-97, .rating-98, .rating-99,
.rating-100 {
    color: var(--success-color) !important;
}

.rating-80, .rating-81, .rating-82, .rating-83, .rating-84,
.rating-85, .rating-86, .rating-87, .rating-88, .rating-89 {
    color: var(--primary-color) !important;
}

.rating-60, .rating-61, .rating-62, .rating-63, .rating-64,
.rating-65, .rating-66, .rating-67, .rating-68, .rating-69,
.rating-70, .rating-71, .rating-72, .rating-73, .rating-74,
.rating-75, .rating-76, .rating-77, .rating-78, .rating-79 {
    color: var(--warning-color) !important;
}

.rating-0, .rating-1, .rating-2, .rating-3, .rating-4,
.rating-5, .rating-6, .rating-7, .rating-8, .rating-9,
.rating-10, .rating-11, .rating-12, .rating-13, .rating-14,
.rating-15, .rating-16, .rating-17, .rating-18, .rating-19,
.rating-20, .rating-21, .rating-22, .rating-23, .rating-24,
.rating-25, .rating-26, .rating-27, .rating-28, .rating-29,
.rating-30, .rating-31, .rating-32, .rating-33, .rating-34,
.rating-35, .rating-36, .rating-37, .rating-38, .rating-39,
.rating-40, .rating-41, .rating-42, .rating-43, .rating-44,
.rating-45, .rating-46, .rating-47, .rating-48, .rating-49,
.rating-50, .rating-51, .rating-52, .rating-53, .rating-54,
.rating-55, .rating-56, .rating-57, .rating-58, .rating-59 {
    color: var(--danger-color) !important;
}

/* 关键指标卡片 */
.metrics-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    background: white;
    padding: 2rem;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.metrics-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.metric-item {
    padding: 1.5rem 0;
    transition: var(--transition);
}

.metric-item:hover {
    transform: scale(1.05);
}

.metric-value {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.8rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.metric-label {
    font-size: 1rem;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 失分统计卡片 */
.loss-stat-card {
    background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
    border: 1px solid rgba(239, 71, 111, 0.15);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
}

.loss-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.loss-stat-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.loss-stat-title i {
    margin-right: 12px;
    color: var(--danger-color);
    font-size: 1.5rem;
}

.loss-stat-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.loss-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.8rem 1.2rem;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.loss-tag:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.loss-tag span {
    font-weight: 800;
    margin-left: 6px;
    font-size: 1.1rem;
}

/* 失分类型颜色 */
.loss-tag.calculation {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border: 2px solid #ffeaa7;
}

.loss-tag.concept {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.loss-tag.careless {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border: 2px solid #bee5eb;
}

.loss-tag.time {
    background: linear-gradient(135deg, #e2e3e5, #d6d8db);
    color: #383d41;
    border: 2px solid #d6d8db;
}

.loss-tag.other {
    background: linear-gradient(135deg, #e2d9f3, #d6c6f5);
    color: #46326d;
    border: 2px solid #d6c6f5;
}

.loss-tag.total {
    background: linear-gradient(135deg, #cce7ff, #b3d9ff);
    color: #004085;
    border: 2px solid #b3d9ff;
}

/* 表格样式增强 */
.loss-table {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    background: white;
    transition: var(--transition);
}

.loss-table:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.loss-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.loss-table th {
    font-weight: 700;
    color: white;
    padding: 1.2rem 1.5rem;
    vertical-align: middle;
    border: none;
    font-size: 1rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.loss-table td {
    padding: 1.2rem 1.5rem;
    vertical-align: middle;
    transition: var(--transition);
    border-color: rgba(0, 0, 0, 0.05);
    font-weight: 500;
}

.loss-table tbody tr {
    transition: var(--transition);
}

.loss-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(67, 97, 238, 0.05) 0%, transparent 100%);
    transform: translateX(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 表格内元素样式 */
.question-number {
    font-weight: 700;
    color: var(--dark-color);
    font-size: 1.1rem;
}

.knowledge-point {
    color: var(--primary-color);
    font-weight: 600;
    background: rgba(67, 97, 238, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.loss-points {
    font-weight: 800;
    color: var(--danger-color);
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(239, 71, 111, 0.2);
}

.loss-description {
    color: #6c757d;
    max-width: 200px;
    line-height: 1.4;
}

/* 失分类型徽章 - 修复后的样式 */
.loss-type-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: inline-block;
    min-width: 100px;
    text-align: center;
}

/* 使用更具体的选择器确保样式应用 */
table .loss-type-badge.calculation_error,
.loss-type-badge.calculation_error {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7) !important;
    color: #856404 !important;
    border: 1px solid #ffeaa7 !important;
}

table .loss-type-badge.concept_not_understood,
.loss-type-badge.concept_not_understood {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb) !important;
    color: #721c24 !important;
    border: 1px solid #f5c6cb !important;
}

table .loss-type-badge.careless_mistake,
.loss-type-badge.careless_mistake {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb) !important;
    color: #0c5460 !important;
    border: 1px solid #bee5eb !important;
}

table .loss-type-badge.time_management,
.loss-type-badge.time_management {
    background: linear-gradient(135deg, #e2e3e5, #d6d8db) !important;
    color: #383d41 !important;
    border: 1px solid #d6d8db !important;
}

table .loss-type-badge.other,
.loss-type-badge.other {
    background: linear-gradient(135deg, #e2d9f3, #d6c6f5) !important;
    color: #46326d !important;
    border: 1px solid #d6c6f5 !important;
}

/* 备选方案：使用属性选择器 */
.loss-type-badge[class*="calculation"] {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border: 1px solid #ffeaa7;
}

.loss-type-badge[class*="concept"] {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.loss-type-badge[class*="careless"] {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.loss-type-badge[class*="time"] {
    background: linear-gradient(135deg, #e2e3e5, #d6d8db);
    color: #383d41;
    border: 1px solid #d6d8db;
}

.loss-type-badge[class*="other"] {
    background: linear-gradient(135deg, #e2d9f3, #d6c6f5);
    color: #46326d;
    border: 1px solid #d6c6f5;
}

/* 分析卡片 */
.analysis-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.analysis-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.analysis-card .card-header {
    background: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.5rem 2rem;
}

.analysis-card .card-body {
    padding: 2rem;
}

/* 学习建议卡片 */
.suggestion-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    background: white;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.suggestion-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.suggestion-card .card-header {
    background: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.5rem 2rem;
}

.suggestion-card .card-body {
    padding: 2rem;
}

.suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    border-radius: 12px;
    background: rgba(248, 249, 250, 0.8);
    transition: var(--transition);
}

.suggestion-item:hover {
    background: rgba(67, 97, 238, 0.05);
    transform: translateX(5px);
}

.suggestion-item:last-child {
    margin-bottom: 0;
}

.suggestion-item i {
    font-size: 2rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, currentColor, transparent);
    color: inherit;
}

.suggestion-item h6 {
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

/* 按钮样式优化 */
.action-btn {
    transition: var(--transition);
    border-radius: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* 模态框样式 */
.delete-modal .modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.delete-modal .modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #fff5f5, #ffeaea);
}

.delete-modal .modal-title {
    font-weight: 700;
    color: var(--danger-color);
    font-size: 1.3rem;
}

.delete-modal .modal-body {
    padding: 2rem;
    color: #495057;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .score-display {
        font-size: 3.5rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }

    .metric-value {
        font-size: 2.2rem;
    }

    .loss-stat-tags {
        gap: 0.8rem;
    }

    .loss-tag {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .loss-table th,
    .loss-table td {
        padding: 1rem 0.8rem;
        font-size: 0.9rem;
    }

    .suggestion-item {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .chart-container {
        height: 200px;
    }

    .loss-type-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
        min-width: 80px;
    }
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.score-main-card,
.score-status-card,
.metrics-card,
.analysis-card,
.suggestion-card,
.loss-stat-card {
    animation: fadeInUp 0.8s ease-out;
}

.score-main-card { animation-delay: 0.1s; }
.score-status-card { animation-delay: 0.2s; }
.metrics-card { animation-delay: 0.3s; }
.loss-stat-card { animation-delay: 0.4s; }
.analysis-card { animation-delay: 0.5s; }
.suggestion-card { animation-delay: 0.6s; }

/* 加载状态 */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 调试样式 - 如果仍有问题可以启用 */
.debug-loss-type::before {
    content: attr(data-debug);
    position: absolute;
    top: -20px;
    left: 0;
    background: red;
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 10px;
    z-index: 1000;
}